<link rel="stylesheet" type="text/css" href="{$smarty.const.URL_BASE}/modules/abbannermodule/css/abbannermodule.css" />
<div class="abbannermodule">
	<h1>Banners management</h1>
	<ul class="manage">
	{assign var=last_type value=-1}
	{foreach name=links from=$items item=link}
	{math equation="x-1" x=$link->rank assign=prev}
	{math equation="x+1" x=$link->rank assign=next}
		<li>
			{if $last_type != $link->show_type}
				<div class="type_title">
					{if $link->show_type == 0}
						Text
					{elseif $link->show_type == 1}
						Image 
					{else}
						Flash
					{/if}
				</div>
			</li>
			<li>
				{assign var=last_type value=$link->show_type}
			{/if}
			{permissions level=$smarty.const.UILEVEL_NORMAL}
			{if $permissions.edit == 1 || $permissions.delete == 1}
			<div class="itemactions">
				{if $permissions.edit == 1}
				<a href="{link action=edit id=$link->id}"><img class="mngmnt_icon" src="{$smarty.const.ICON_RELATIVE}edit.png" title="{$_TR.alt_edit}" alt="{$_TR.alt_edit}" /></a>
				{/if}
				{if $permissions.delete == 1}
				<a href="{link action=delete id=$link->id}"><img class="mngmnt_icon" src="{$smarty.const.ICON_RELATIVE}delete.png" title="{$_TR.alt_delete}" alt="{$_TR.alt_delete}" onclick="return confirm('{$_TR.delete_link_confirm}');" /></a>
				{/if}
				{if $smarty.foreach.links.first == 0}
				<a href="{link action=rank_switch a=$link->rank b=$prev id=$link->id}">			
					<img src="{$smarty.const.ICON_RELATIVE}up.png" title="{$_TR.alt_previous}" alt="{$_TR.alt_previous}" />
				</a>
				{/if}
				{if $smarty.foreach.links.last == 0}
				<a href="{link action=rank_switch a=$next b=$link->rank id=$link->id}">
					<img src="{$smarty.const.ICON_RELATIVE}down.png" title="{$_TR.alt_next}" alt="{$_TR.alt_next}" />
				</a>
				{/if}
			</div>
			{/if}
			{/permissions}
			<strong>{$link->title}</strong>{br}
			{if $link->show_type == 0}
				{$link->text_value}
			{/if}
			{if $link->show_type == 1}
				<img src="{$smarty.const.BASE_URL}/phpThumb.php?src={$link->img_path}&w=100">
			{/if}
			{if $link->show_type == 2}
				<embed height="100" width="100" allowscriptaccess="always" wmode="transparent" loop="true" play="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"  src="{$link->flash_path}">                            
			{/if}
			<div class="clear"></div>
		</li>
	{foreachelse}
	<li align="center"><i>{$_TR.no_link}</i></li>
	{/foreach}
	</ul>
	<br>
	<div class="actions">
		{permissions level=$smarty.const.UILEVEL_NORMAL}
		{if $permissions.create == 1}
			<a class="text" href="{link action=edit type=0}">New Text</a>
			<a class="image" href="{link action=edit type=1}">New Image</a>
			<a class="flash" href="{link action=edit type=2}">New Flash</a>
		{/if}
		{/permissions}
	</div>	
</div>
